#ifndef __SERVER_NOTIFYRECIEVER_H__
#define __SERVER_NOTIFYRECIEVER_H__

#include "gwmessagetab.hpp"
#include "IMessageOperator.h"
#include "protonet.hpp"
#include "../GlobalTab.h"
#include "global.pb.h"
#include "../Sender/GBServer_NotifySender.h"

/**
*@file       GBServer_NotifyReciever.h
*@brief      process message GBServer_Notify
*
*@author     graywind
*@version    1.0.0.0
*@data       2012/3/16
*/

///process message
class OnGBServer_Notify
{
public:
    ///@brief    process message
    ///param[in] op            operator type
    ///param[in] session_id    identifier of session
    ///param[in] pMsgBuffer    message buffer
    ///param[in] msg_bytes     byte length of message buffer
    ///retval    void
    static void OnMapping(IMessageOperator* op, int session_id, void* pMsgBuffer, unsigned long msg_bytes)
    {
        //TODO
        ServerNotify sn;
        if(ProtoNet<ServerNotify>::CreateFromBytes(sn, pMsgBuffer, msg_bytes) == true)
        {
            if(sn.servertype() == GatewayServer)
            {
                op->RegisterServer(session_id);
            }
        }
    }
};

///[message group]  [message type]  [function table] [handler]
RegisterMessageTab(GlobalTypes, GBServer_Notify, GlobalTab, OnGBServer_Notify);
#endif
